<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<!--user管理栏-->i
<div th:fragment="usermanage(which)" class="row">
    <ul class="nav nav-tabs">
        <li th:class="${#strings.equals('article',which)?'active':''}" role="presentation">
            <a th:href="@{/user/main}">管理博客</a></li>
        <li th:class="${#strings.equals('add',which)?'active':''}" role="presentation">
            <a th:href="@{/user/addArticle}">添加博客</a></li>
        <li th:class="${#strings.equals('tag',which)?'active':''}" role="presentation">
            <a th:href="@{/user/collection}">我的收藏</a></li>
    </ul>
</div>


<nav th:fragment="navbar(which)" class="navbar"
     style="border-radius: 15px;background-color: white;border-bottom: aliceblue solid 3px">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar" style="background-color: rgba(0,0,0,0.14)"></span>
                <span class="icon-bar" style="background-color: rgba(0,0,0,0.14)"></span>
                <span class="icon-bar" style="background-color: rgba(0,0,0,0.14)"></span>
            </button>
            <div class="navbar-header" style="margin-right: 1em;margin-left: 1em">
                <a th:href="@{/}">
                    <h4 style="color: #0084ff;font-weight: bold;line-height: 30px;font-family:  'Arial','Microsoft YaHei','黑体','宋体',sans-serif;">
                        我会Jvav啊</h4>
                </a>
            </div>

        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li th:class="${#strings.equals(which,'dashboard')?'active1':''}"><a th:href="@{/}">首页</a></li>
                <li th:class="${#strings.equals(which,'hot')?'active1':''}"><a th:href="@{/hot}">热榜</a></li>
                <li th:class="${#strings.equals(which,'attention')?'active1':''}"><a th:href="@{/user/attention}">关注</a></li>
                <li th:class="${#strings.equals(which,'star')?'active1':''}"><a th:href="@{/user/collection}">收藏</a></li>
                <li th:if="${session.get('user')!=null&&#strings.equals(session.get('user').getUsername(),'admin')}"><a th:href="@{/user/admin}">管理员</a></li>
                <style>
                    .active1 {
                        font-weight: bold;
                        color: black;
                        background-color: aliceblue;
                        border-radius: 3px;
                    }
                </style>
            </ul>
            <form th:action="@{/search}" class="navbar-form navbar-left">
                <div class="input-group">
                    <input type="text" name="keyword" class="form-control" placeholder="Search for...">
                    <span class="input-group-btn">
                        <button type="submit" style="background-color: #0084ff;color: white"
                                class="btn btn-default btn-info">提交</button>
                </span>
                </div>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li th:class="${#strings.equals(which,'write')?'active2':''}"><a th:href="@{/user/main}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>创作中心</a></li>
                <style>
                    .active2 {
                        font-weight: bold;
                        color: black;
                        background-color: aliceblue;
                        border-radius: 3px;
                    }
                </style>
                <li th:if="${session.get('user')==null}" style="line-height: 55px">
                    <a th:href="@{/login}">
                        <span class="glyphicon glyphicon-log-in" aria-hidden="true"></span> 登录
                    </a>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        <img th:src="${session.get('user')==null?'https://pic1.zhimg.com/da8e974dc_is.jpg':session.get('user').getAvatar()}"
                             class="img-circle" width="25px"
                             height="25px"> <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <a th:href="@{/user/manage}">
                            <div>
                                <button type="button" style="text-decoration-line: none" class="btn btn-link">
                                    <span class="glyphicon glyphicon-user" aria-hidden="true"></span> 个人中心
                                </button>
                            </div>
                        </a>
                        <a th:href="@{/user/main}">
                            <div >
                                <button type="button" style="text-decoration-line: none" class="btn btn-link">
                                    <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 创作中心
                                </button>
                            </div>
                        </a>

                        <a th:href="@{/exit}">
                            <div>
                                <button type="button" style="text-decoration-line: none" class="btn btn-link">
                                    <span class="glyphicon glyphicon-off" aria-hidden="true"></span> 退出
                                </button>
                            </div>
                        </a>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>


</html>

